/* eslint valid-jsdoc: 'off' */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 * 
 */

const isLinuxEnvironment = require('os').platform() === 'linux';

if (isLinuxEnvironment) {
  host = 'mysql';
  username = 'root';
  password = '91vDQhMgF9wzZlYf/MTUiZzAebT9D8Yi';
} else {
  host = 'localhost';
  username = 'wjffff';
  password = 'wjffff';
}

const mysqlConfig = {
  host,
  port: 3306,
  username,
  password
};

module.exports = appInfo => {
  /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
  const config = (exports = {});

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1716451288095_8483';

  config.sequelize = {
    dialect: 'mysql',
    dialect: "mysql",
    ...mysqlConfig,
    timezone: '+08:00',
    database: 'server',
    define: {
      // 使用自定义的表名
      freezeTableName: true,
      // 自动生成时间戳 -小驼峰式
      timestamps: true,
      // 表名小驼峰
      underscored: false,
    },
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
